﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace peonwar
{
        [Serializable]
    class UnitLight2 : Unit
    {
        // ---CONSTRUCTORS---
        // Creation de l'unite en precisant l'instance du joueur "User"
        public UnitLight2(User player) : base()
        {
            // Caracteristique au type d'unité
            UnitType = 2;
            QueueOffset = 50;

            Initialize(player);
        }

        // ---PROPERTIES---
        // ---METHODES---
        // Animation idle qui joue en boucle
        public override void AnimationIdle()
        {
            base.AnimationIdle();
            Texture = GameTexture.TextureUnitLight2[0];
            Imgwidth = 46;
            Imgheight = 37;
            Indexmax = 7;

            Offset = 12;
        }

        // Animation walk qui est jouer en boucle une fois lancer
        public override void AnimationWalk()
        {
            base.AnimationWalk();
            Texture = GameTexture.TextureUnitLight2[1];
            Imgwidth = 60;
            Imgheight = 39;
            Indexmax = 9;

            Offset = 0;
        }

        // Animation degain de l'arme qui lance ensuite l'animation tirer
        public override void AnimationDrawIn()
        {
            base.AnimationDrawIn();
            Texture = GameTexture.TextureUnitLight2[2];
            Imgwidth = 63;
            Imgheight = 40;
            Indexmax = 4;

            Offset = 5;
        }

        // Animation tirer joue en boucle
        public override void AnimationFire()
        {
            base.AnimationFire();
            Texture = GameTexture.TextureUnitLight2[3];
            Imgwidth = 65;
            Imgheight = 45;
            Indexmax = 21;

            Offset = 1;
        }

        // Animation rengainer l'arme qui lance ensuite l'animation marcher
        public override void AnimationDrawOut()
        {
            base.AnimationDrawOut();
            Texture = GameTexture.TextureUnitLight2[4];
            Imgwidth = 74;
            Imgheight = 39;
            Indexmax = 2;

            Offset = 19;
        }

        // Animation mourrir, pas besoin de l'expliquer
        public override void AnimationDie()
        {
            base.AnimationDie();
            Texture = GameTexture.TextureUnitLight2[5];
            Imgwidth = 90;
            Imgheight = 40;
            Indexmax = 15;

            Offset = -10;
        }

        protected override void Fire(bool firebase, User enemy)
        {
            int sign = -1;
            if (TeamBlue)
                sign = 1;
            User.EffectList.Add(new AnimatedEffect(Position.X + (sign * 38), Position.Y - 32, TeamBlue, GameTexture.TextureEffects[0], 40, 38, 6));
        }
    }
}
